<?php
namespace PsiFramework\Classes\Util\HTTP;

import("Classes.Model.Object");
import("Classes.Model.SessionUser");
import("Classes.Util.Object.Date");

use \PsiFramework\Classes\Model\Object;
use \PsiFramework\Classes\Model\SessionUser;
use \PsiFramework\Classes\Util\Object\Date;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The Connection class describes the information for a Connection
 *
 * @package Util.HTTP
 */
class Connection extends Object
{

    protected /*SessionUser*/    $_user ;
    protected /*string*/         $_sessionId ;
    protected /*string*/         $_ipAddress ;
    protected /*Date*/           $_lastSeen ;

    /**
     * Constructor
     *
     * @param     SessionUser    $user        the user
     * @param     string        $sessionId    the session id
     * @param     string        $ipAddress    the ip address
     * @param     Date        $lastSeen    when was the last action registered
     * @return    Connection    instance
     */
    public function __construct(
        Object     $user=null,
        /*string*/ $sessionId=null,
        /*string*/ $ipAddress=null,
        Date       $lastSeen=null
    )
    {
        $this->_user = $user;
        $this->_sessionId = $sessionId ;
        $this->_ipAddress = $ipAddress ;
        if ($lastSeen === null) {
            $lastSeen = Date::now();
        }
        $this->_lastSeen = $lastSeen ;
    }

    public function getId()
    {
        
    }
    
    /**
     * Getter for the member variable user
     *
     * @return    User    the user
     */
    public function getUser()
    {
        return $this->_user ;
    }

    /**
     * Getter for the member variable sessionId
     *
     * @return    string    the session id
     */
    public function getSessionId()
    {
        return $this->_sessionId ;
    }

    /**
     * Getter for the member variable ipAddress
     *
     * @return    string    the ip address
     */
    public function getIpAddress()
    {
        return $this->_ipAddress ;
    }

    /**
     * Getter for the member variable lastSeen
     *
     * @return    Date    the last seen date
     */
    public function getLastSeen()
    {
        return $this->_lastSeen ;
    }

    public function toString()
    {
        
    }
}
